package com.JingYan.Thread;

import lombok.extern.slf4j.Slf4j;

/**
 * 中断线程需要的测试线程
 *
 * @author Dong_Jia_Qi on 2022/6/4
 */
@Slf4j
public class InterruptATread extends Thread {
    public InterruptATread() {
    }

    public InterruptATread(Runnable target) {
        super(target);
    }

    public InterruptATread(ThreadGroup group, Runnable target) {
        super(group, target);
    }

    public InterruptATread(String name) {
        super(name);
    }

    public InterruptATread(ThreadGroup group, String name) {
        super(group, name);
    }

    public InterruptATread(Runnable target, String name) {
        super(target, name);
    }

    public InterruptATread(ThreadGroup group, Runnable target, String name) {
        super(group, target, name);
    }

    public InterruptATread(ThreadGroup group, Runnable target, String name, long stackSize) {
        super(group, target, name, stackSize);
    }

    @Override
    public void run() {
        Thread thread = new InterruptBTread("中断示例线程B");
        thread.start();
        try {
            thread.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
            log.info("被中断了");
        }
        thread.interrupt();
    }
}
